import { request } from "@umijs/max";

// 获得角色
export function GetRoleFnc () { 
  return request('/roles', {
    method: 'get'
  })
}

// 修改角色
export function EditRoleFnc (id: number, data: any) { 
  return request(`/roles/${id}`, {
    data: data,
    method: 'put'
  })
}

// 删除整个角色分类下的单独子分类
export function DeleteRoleChildFnc (roleID: number, rightID: number) { 
  return request(`/roles/${roleID}/rights/${rightID}`, {
    method: 'delete'
  })
}

// 展示权限分配盒子
export function ShowRightFnc () { 
  return request('/rights/tree', {
    method: 'get'
  })
}
  
// 更新权限分配
export function SetRightFnc (id: number, data: {rids: string}) { 
  return request(`/roles/${id}/rights`, {
    method: 'post',
    data: data
  })
}